package com.app.sdnotepad;

import com.app.sdnotepad.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

public class NPTitleEditor extends Activity {

	String fileName = null;
	EditText fileNameText = null;
	Intent getIntent = null;
	
	public void onClickOK(View view)
	{
		String cmdString = "CMD_NEW_FILENAME";
		Intent backFileNameIntent = new Intent();
		backFileNameIntent.putExtra("CMD", cmdString);
		backFileNameIntent.putExtra("NEW_FILENAME", fileNameText.getText().toString());
		this.setResult(RESULT_OK , backFileNameIntent);
		this.finish();
	}
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.title_editor);
		
		/* get file name */
		getIntent = getIntent();
		fileName = getIntent.getStringExtra("FILENAME");
		/* set default file name */
		fileNameText = (EditText) findViewById(R.id.titleEdit);
		if (fileName != null)
		{
			fileNameText.setText(fileName);
		}
		
		
	}

}
